package org.ipower.examsystem.service.impl;

import java.util.List;
import org.ipower.examsystem.dao.ItemTopicsDao;
import org.ipower.examsystem.domain.ItemTopics;
import org.ipower.examsystem.service.Topic;
import org.ipower.examsystem.service.TopicService;
import org.ipower.platform.domain.Pager;
import org.ipower.platform.domain.QueryCondition;

/**
 * 题目服务实现类。
 * @author young
 */
public class TopicServiceImpl implements TopicService {
    private static final long serialVersionUID = 1L;
    private ItemTopicsDao dao = null;
    
    @Override
    public void setTopicDao(ItemTopicsDao dao) {
        this.dao = dao;
    }
    
    @Override
    public Pager<ItemTopics> findAll(String ascProperty, boolean isAsc, int start, int limit, List<QueryCondition> entites) {
         if(this.dao != null){
             return this.dao.findAll(ascProperty, isAsc, start, limit, entites);
         }
         return null;
    }
    
    @Override
    public void Save(Topic topic) {
       if(this.dao != null && topic != null && topic.getTopicsID() != null && !topic.getTopicsID().isEmpty()){
           this.dao.Save(topic);
       }
    }
    
    @Override
    public void delete(String topicID) {
        if(this.dao != null && topicID != null && !topicID.isEmpty()){
            this.dao.delete(topicID);
        }
    }
}